import QtQuick 1.1
import com.meego 1.0
import "Citys.js" as CityUtil

Page
{
    id:mainPage
    tools: commonTools
    orientationLock: PageOrientation.LockPortrait

    Image {
        id: home_loading_image
        width:parent.width; height: parent.height;
        source: "qrc:/images/toolbar/back.png"
    }

    // 新闻
    ArticlePage{id: article_page}
    // 车型库
    ModulelibsPage{id: modulelibs_page}
    // 收藏夹
    FavoritesPage{id: favorites_page}
    // 论坛
    ForumPage{id: forum_page}
    // 更多
    MorePage{id: more_page}


    Component.onCompleted: {
        CityUtil.syncCurrentCity();
        article_tab.push(article_page)
        modulelibs_tab.push(modulelibs_page)
        forum_tab.push(forum_page)
        more_tab.push(more_page)
        theme.inverted = true
    }
    TabGroup {
        id: tabGroup
        currentTab: article_tab

        PageStack {
            id: article_tab
        }
        PageStack {
            id: modulelibs_tab
        }
        PageStack {
            id: forum_tab
        }
        PageStack {
            id: favorites_tab
        }
        PageStack {
            id: more_tab
        }
    }

    ToolBarLayout {
        id: commonTools
        visible: true
        ButtonRow {
            platformStyle: TabButtonStyle { }
            TabButton {
                iconSource: "../images/toolbar/btn_1.png"
                tab: article_tab
            }
            TabButton {
                iconSource: "../images/toolbar/btn_2.png"
                tab: modulelibs_tab
            }
            TabButton {
                iconSource: "../images/toolbar/btn_4.png"
                tab: forum_tab
            }
            TabButton {
                iconSource: "../images/toolbar/btn_3.png"
                onClicked: {mainPage.pageStack.push(Qt.resolvedUrl("FavoritesPage.qml"))}
            }
            TabButton {
                iconSource: "../images/toolbar/btn_5.png"
                tab: more_tab
            }
        }

        ToolButtonStyle{
            id: toolBar_style
            backgroundVisible: false
            pressedBackground: "image://theme/meegotouch-button-navigationbar-button" + __invertedString + "-background-pressed"
        }
    }



}
